# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
#
# TODO: Figure out how to ditch out Polkit (make it optional).
pkgname=fprintd
pkgver=1.94.3
pkgrel=0
pkgdesc="Daemon that provides fingerprint scanning functionality over D-Bus"
url="https://fprint.freedesktop.org/"
arch="all"
license="GPL-2.0-or-later"
depends="dbus"
makedepends="
	bash
	basu-dev
	cmd:pod2man
	gettext-dev
	libfprint-dev>=$pkgver
	linux-pam-dev
	meson
	polkit-dev
	"
checkdepends="
	dbus
	py3-cairo
	py3-dbus
	py3-dbusmock
	"
subpackages="$pkgname-doc $pkgname-lang $pkgname-pam"
source="https://gitlab.freedesktop.org/libfprint/fprintd/-/archive/v$pkgver/fprintd-v$pkgver.tar.gz
	add-test-feature-and-make-tests-optional.patch
	pam-include-time.patch
	pam-use-basu-and-remove-sd-login.patch
	fix-missing-libintl.patch
	"
builddir="$srcdir/$pkgname-v$pkgver"
options="!check"  # tests are broken, they expect fprintd installed in "/"

build() {
	abuild-meson \
		-Dman=true \
		-Dgtk_doc=false \
		-Dsystemd=false \
		-Dlibsystemd=basu \
		-Dpam=true \
		-Dtest=disabled \
		output
	meson compile -C output
}

check() {
	meson test -C output --no-rebuild --print-errorlogs --no-stdsplit
}

package() {
	DESTDIR="$pkgdir" meson install -C output --no-rebuild
}

pam() {
	pkgdesc="PAM module for fingerprint authentication"

	amove lib/security
}

sha512sums="
968fa14897f14b28875cafde30eaf885adc236ab570cfac8851d7cb6d67009b5ef9087b17baa02f36293537f237a8b66fc772af0036f6fb9ac76bd63dd265ef4  fprintd-v1.94.3.tar.gz
b708581858084f8541026785dbdea4a2a783d082c53e4d9544a1a3f9ec03dfed0afbe0ca1e3070875028d4be88f375221e72ae27899bbfd006e4c1ce4713d7ed  add-test-feature-and-make-tests-optional.patch
08d489d3dce24f921777f5e90f716596aee99f8d1dfe794368bf92bd39313731225e0750375826454c22974316fd9d13b7e6405ae3f1f5b54dd418e61d512589  pam-include-time.patch
0fd20371cb710095db6ab0ca80db6308e876b44455be22f77297c756e7ed8a5292687706928f33015477ddc01b4f939ba7e111d56a90396ced863f5dc6948a84  pam-use-basu-and-remove-sd-login.patch
4e1aee3c3250924a48f45a28f2f624f15641fe9957987bdd61df8f4af1253e7d56d913570101fd05c37cd0e917be1391d44ae6ab7246119b462515e1159ad952  fix-missing-libintl.patch
"
